package com.huabo.system.service.impl;

import com.hbfk.util.PageInfo;
import com.huabo.system.config.DateBaseConfig;
import com.huabo.system.mysql.entity.TblMonitorIndicatorresultMySql;
import com.huabo.system.mysql.mapper.TblMonitorIndicatorresultMySqlMapper;
import com.huabo.system.oracle.entity.TblMonitorIndicatorresult;
import com.huabo.system.oracle.mapper.TblMonitorIndicatorresultMapper;
import com.huabo.system.service.TblMonitorIndicatorresultService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

@Service
public class TblMonitorIndicatorresultServiceImpl implements TblMonitorIndicatorresultService {

    @Resource
    private TblMonitorIndicatorresultMapper tblMonitorIndicatorresultMapper;

    @Resource
    private TblMonitorIndicatorresultMySqlMapper tblMonitorIndicatorresultMySqlMapper;


    @Override
    public Map<String, Object> getResultListJKZX(PageInfo<TblMonitorIndicatorresult> pageInfo, BigDecimal indicatorid, BigDecimal solutionresultid) {
        if (DateBaseConfig.DATABASETYPE.equals("Oracle")) {
            Map<String, Object> resultMap = new HashMap<String, Object>(0);
            pageInfo.setTlist(tblMonitorIndicatorresultMapper.getResultListJKZX(pageInfo, indicatorid, solutionresultid));
            pageInfo.setTotalRecord(tblMonitorIndicatorresultMapper.getResultListJKZXCount(indicatorid, solutionresultid));
            resultMap.put("code", "1");
            resultMap.put("msg", "访问接口成功");
            resultMap.put("data", pageInfo);
            return resultMap;
        } else {
            Map<String, Object> resultMap = new HashMap<String, Object>(0);
            pageInfo.setTlist(tblMonitorIndicatorresultMySqlMapper.getResultListJKZX(pageInfo, indicatorid, solutionresultid));
            pageInfo.setTotalRecord(tblMonitorIndicatorresultMySqlMapper.getResultListJKZXCount(indicatorid, solutionresultid));
            resultMap.put("code", "1");
            resultMap.put("msg", "访问接口成功");
            resultMap.put("data", pageInfo);
            return resultMap;
        }
    }
}
